package com.gitee.deeround.jdbchelper;

import com.gitee.deeround.jdbchelper.core.*;
import com.gitee.deeround.jdbchelper.out.DataTable;
import com.gitee.deeround.jdbchelper.out.PageList;
import com.gitee.deeround.jdbchelper.resultSetExtractors.CustomApply;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

public interface DbAction extends DbActionQuery, DbActionExecute, DbActionDdl, DbActionFunc, DbActionExt {


    //重新和新增了部分方法，目的为了方便传参数


    //================queryForDataTable===================

    @Override
    DataTable queryForDataTable(String sql, Object... args);


    //================queryForList===================

    @Override
    List<Map<String, Object>> queryForList(String sql, Object... args);

    <T> List<T> queryForListObject(String sql, Class<T> elementType, Object... args);

    <T> List<T> queryForListObject(String sql, CustomApply<T> customApply, Object... args);


    //================queryForObject（只取第一行数据）===================

    @Override
    Map queryForMap(String sql, Object... args);

    <T> T queryForObject(String sql, Class<T> elementType, Object... args);

    <T> T queryForObject(String sql, CustomApply<T> customApply, Object... args);


    //================queryForValue(只取第一行第一列的值，无数据为null)===================

    @Override
    Object queryForValue(String sql, Object... args);

    @Override
    String queryForString(String sql, Object... args);

    @Override
    Integer queryForInteger(String sql, Object... args);

    @Override
    BigDecimal queryForDecimal(String sql, Object... args);


    //================queryForPage===================

    PageList<Map<String, Object>> queryForPage(String sql, int pageNum, int pageSize, Object... args);

    <T> PageList<T> queryForPage(String sql, int pageNum, int pageSize, Class<T> elementType, Object... args);

    <T> PageList<T> queryForPage(String sql, int pageNum, int pageSize, CustomApply<T> customApply, Object... args);


}
